package com.taiyi.renaissancemall.ui.mine.wallet;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.taiyi.renaissancemall.R;
import com.taiyi.renaissancemall.bean.MyScoresBean;

import java.util.List;

public class MyWalletListAdapter extends BaseQuickAdapter<MyScoresBean, BaseViewHolder> {
    public MyWalletListAdapter(int layoutResId, @Nullable List<MyScoresBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, MyScoresBean item) {

        /*
        txtype 1已同意2审核中3拒绝
        1 - 已完成
        2 - 审核中
        3 + 已驳回
         */
        String money = "";
        if (item.txtype != null) {
            if ("1".equals(item.txtype)) {
                helper.setText(R.id.tv_where, "已完成");
            } else if ("2".equals(item.txtype)) {
                helper.setText(R.id.tv_where, "审核中");
            } else if ("3".equals(item.txtype)) {
                helper.setText(R.id.tv_where, "已驳回");
            }
        }
        //"payType":"1获取+ 2消费-"
        if (item.payType == null
                || "".equals(item.payType)
                || "null".equals(item.payType)) {
            money = item.money;
        } else {
            if ("1".equals(item.payType)) {
                money = "+" + item.money;
            } else if ("2".equals(item.payType)) {
                money = "-" + item.money;
            } else {
                money = item.money;
            }
        }

        helper.setText(R.id.amountTv, money);

        helper.setText(R.id.sourceTv, item.title);
        helper.setText(R.id.dateTv, item.createtime);
    }
}
